<template>
    <div>
        <van-address-edit
            :area-list="areaList"
            :address-info="addressIfo"
            show-postal
            show-delete
            show-set-default
            show-search-result
            :area-columns-placeholder="['请选择', '请选择', '请选择']"
            @save="onSave"
            @delete="onDelete"
            />
    </div>
</template>

<script>
import { Toast} from 'vant';
import { areaList } from '@vant/area-data';
    export default {
    data() {
        return {
        areaList,
        addressIfo:{}
        };
    },
    created () {
            if(this.$route.query.item)//判断如果不为空则，渲染初始信息
                this.addressIfo=this.$route.query.item;
    },
    methods: {
        onSave(content) {
            this.$store.commit('addressList/setAddressList',content)
            Toast('保存成功！');
            this.$router.push('/address')
        },
        onDelete() {
        Toast('delete');
        },
     },
    };
</script>

<style lang="scss" scoped>
/deep/.van-address-edit__buttons{
    padding-top: 100px;
}
/deep/.van-button--danger{
    background-color: orange;
    border: orange;
}
</style>